﻿/*
 * RegExpress
 * 
 * Copyright (c) 2010, Daniel McGaughran
 * 
 * Licensed under the Apache Licence, Version 2.0 (the "Licence");
 * you may not use this file except in compliance with the Licence.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the Licence is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the Licence for the specific language governing permissions and
 * limitations under the Licence.
 * 
 */

using System;
using System.Text.RegularExpressions;
using System.Windows.Controls;
using RegExpressModel.Entities;


namespace RegExpress.UI.HostControls
{
    public partial class FindMatches : UserControl
    {
		public FindMatches()
        {
            InitializeComponent();
        }


		private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			ListBox list = e.Source as ListBox;

			if (list == null) return;

			SingleMatchResult matchResult = list.SelectedValue as SingleMatchResult;
			if(matchResult != null && matchResult.ResultStatus == MatchResultType.Matches)
			{
				Match match = matchResult.MatchResult;
				inputBox.Select(match.Index, match.Length);
				inputBox.Focus();
			}

		}


    }
}
